package com.sbw.java.advanced.demo.common.exceptions;

/**
 * 业务异常
 *
 * @author sangbowei 2018-7-11
 * @description 当业务执行过程中, 需要提示某些业务信息时抛出该异常
 */
public class BusinessException extends RuntimeException {

    /**
     * 业务信息编码
     */
    private String responseCode;
    /**
     * 业务信息编码
     */
    private String responseMsg;

    /**
     * 业务信息参数
     */
    private Object[] args;


    public BusinessException() {
        super();
    }

    /*public BusinessException(String errorCode, Object... theArgs) {
        this.businessCode = errorCode;
        this.args = theArgs;
    }*/

    public BusinessException(String errorCode, String errorMsg) {
        this.responseCode = errorCode;
        this.responseMsg = errorMsg;
    }

    public String getResponseCode() {
        return responseCode;
    }

    public String getResponseMsg() {
        return responseMsg;
    }

    @Override
    public String toString() {
        return "{" + getClass().getName() + "@" + hashCode() + "[" + responseCode + "()]:" + responseMsg + "}";
    }

}
